/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * TilePropertiesEditor.java
 *
 * Created on 21.01.2011, 18:56:10
 */

package editor;

public class TilePropertiesEditor extends javax.swing.JFrame {

    /** Creates new form TilePropertiesEditor */
    public TilePropertiesEditor() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        ObjectListTable = new javax.swing.JTable();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Tile Properties Editor");
        setAlwaysOnTop(true);

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        ObjectListTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"Left Corner", 0},
                {"Right Corner", 1},
                {"Inner Right Corner", 2},
                {"Inner Left Corner", 3},
                {"Left Border", 4},
                {"Right Border", 5},
                {"Top Border", 6},
                {"Plain", 7}
            },
            new String [] {
                "Border Type", "Tile Number"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.Integer.class
            };
            boolean[] canEdit = new boolean [] {
                false, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        ObjectListTable.setName("ObjectListTable"); // NOI18N
        ObjectListTable.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                ObjectListTablePropertyChange(evt);
            }
        });
        jScrollPane1.setViewportView(ObjectListTable);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 374, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void ObjectListTablePropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_ObjectListTablePropertyChange
        for(int i = 0; i < ObjectListTable.getRowCount(); i++){
            Map.tile[i] = Integer.parseInt(""+ObjectListTable.getValueAt(i, 1));
        }
    }//GEN-LAST:event_ObjectListTablePropertyChange

    // Variables declaration - do not modify//GEN-BEGIN:variables
    public static javax.swing.JTable ObjectListTable;
    public javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration//GEN-END:variables

}
